/*
 * @Author: humengchuan 531537052@qq.com
 * @Date: 2023-10-25 17:20:39
 * @LastEditors: humengchuan 531537052@qq.com
 * @LastEditTime: 2023-10-26 20:08:40
 * @FilePath: \projecte:\学习\react\react-vite\src\page.jsx
 * @Description: 
 */
import TestPage from './componment/test/test'
import { useState, useEffect } from 'react'
import './componment/page.css'

const useViews = () => {
    const [value, setValue] = useState(100)
    const handleClickAdd = () => {
        setValue(value + 1)
        // setTimeout(()=>{
        //     setValue(value + 1)
        //     setValue(value + 1)
        //     console.log('111',value)
        //     setValue(value + 1)
        //     setValue(value + 1)
        //     console.log('222',value)
        // }, 300)
    }
    const handleClickReduce = () => {
        setValue(value - 1)
    }
    // const handleJumpHeart = () => {
        
    // }
    useEffect(() =>{
        console.log('%c [  ]-31', 'font-size:13px; background:pink; color:#bf2c9f;', 2333)
        // handleJumpHeart(1)
       
        // let number = 1
        // let timer = null
        // const fn = (num) => {
        //     number = num + 1
        //     timer = setTimeout(() => {
        //         console.log('心跳+', number)
        //         fn(number)
        //     }, 1000)
        // }
        // timer = setTimeout(() => {fn(number)}, 1000)
        // return () => { clearTimeout(timer) }
        // let arr = [2,3,1,6,8,3,5,7,10,9]
        // console.log(arr.sort((a,b) => { return a - b}))
        // console.log('start')

        // setTimeout(() => {
        //     console.log('a')
        //     Promise.resolve().then(() => {console.log('c')})

        // })

        // Promise.resolve(
        //     console.log(1)
        // ).then(() => {
        //     console.log('b')
        //     setTimeout(() => { console.log('d')})
        // })

        // console.log('end')
    }, []
    )
  return (
    <>
     <TestPage />
     <div className='buffer'>
        <span className='button' onClick={handleClickAdd} >加</span>
        <span className='button' onClick={handleClickReduce}>减</span>
        <div className='showValue'>展示值：{value}</div>
     </div>
     
    </>
  )
}

export default useViews